<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width , initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function j() {
            let n = +prompt("请输入一个数")
            let k = 1
            let arr = []
            let ars
            for (i = n; i > 0; i--) {
                k *= i
                arr.push(i)
            }
            ars = arr.join("*")
            return `${ars}=${k}`
        }
        document.write(j())
        console.log(k);
        console.log(ars, "=", k)

        // function jc(n){
        //     if(n===0||n===1){
        //         return 1;
        //     }else{
        //         return n * jc(n - 1);
        //     }
        // }
        // document.write(jc(prompt("请输入")))
    </script>
</body>

</html>